<?php       
    //$hinhanhs = $viewModel->get('hinhanhs'); 
    $baiviet = $viewModel->get('baiviet'); 
    $cothemuonxems = $viewModel->get('cothemuonxems'); 
 ?>


        <section class="main_content">
        <div class="container">
            <div class="row">
                <p class="sitemap">
					<a href="<?php echo BASE_URL; ?>">Trang chủ</a> <span class="glyphicon glyphicon-play"></span>
                    <a href="<?php echo BASE_URL.'baiviet/category/'.$baiviet->TuKhoaDanhMuc; ?>"><?php echo $baiviet->TenDanhMuc ?></a> <span class="glyphicon glyphicon-play"></span>
				    <?php echo $baiviet->TieuDe ?>                  
				</p>
                <div class="col-md-9">
                    <h1 style="font-size:20px; font-weight: bold"><?php echo $baiviet->TieuDe;?></h1>                
                    <span class="glyphicon glyphicon-calendar time">
                        <?php 
                            $date = date_create($baiviet->NgayTao);
                            echo date_format($date, 'd/m/Y H:i:s');
                        ?>
                    </span>  
                    <span class="glyphicon glyphicon-eye-open view" style="margin-left:30px">
                      <?php echo $baiviet->SoLuotXem ?>                   
                    </span>
                    <hr>
                    <?php echo $baiviet->NoiDung;?>
                    <hr>
                    <span class="glyphicon glyphicon-tags"></span> <a class="tag" href="<?php echo BASE_URL.'baiviet/category/'.$baiviet->TuKhoaDanhMuc; ?>"><?php echo $baiviet->TenDanhMuc;?></a>
                    <hr>
                </div>
                <div class="col-md-3">
                    <div class="panel panel-info">
                        <div class="panel-heading">Bài viết cùng chủ đề</div>
                        <div class="panel-body">
                                    <ul>
                                    <?php foreach ($cothemuonxems as $cothemuonxem) { ?>                                    
                                      <li class="media bt-top">
                                        <a class="pull-left" href="<?php echo BASE_URL.'baiviet/detail/'.$cothemuonxem->DuongDan; ?>">
                                          <img height="60px" width="70px" src="<?php if(!empty($cothemuonxem->AnhThumb)){echo $cothemuonxem->AnhThumb;}else{echo PATH_IMAGE.'bai-viet.png';}  ?>" title="<?php echo $cothemuonxem->TieuDe ?>" alt="<?php echo $cothemuonxem->TieuDe ?>" class="img">
                                        </a>
                                        <div class="media-body">                  
                                            <h4 class="media-heading">
                                              <a class="pull-left cothemuonxem" href="<?php echo BASE_URL.'baiviet/detail/'.$cothemuonxem->DuongDan; ?>">
                                                
                                                  <?php 
                                                    if (strlen($cothemuonxem->TieuDe)<45)
                                                    {
                                                      echo $cothemuonxem->TieuDe;
                                                    }
                                                    else
                                                    {
                                                      echo substr($cothemuonxem->TieuDe, 0, 45).'...';
                                                    }
                                                 ?>
                                              </a>
                                            </h4>
                                             <br>
                                             
                                                  <span class="glyphicon glyphicon-eye-open view">
                                                    <?php echo $cothemuonxem->SoLuotXem; ?>                   
                                                  </span>
                                             
                                        </div>
                                      </li>
                                    <?php } ?> 
                                </ul>
                                     
                        </div>
                    </div>
                    <a href="#"><img width="100%" src="<?php echo PATH_IMAGE.'banner/banner-du-lich-thai-lan.png' ?>" class="img-responsive"></a>
                    <br>
                    <a href="#"><img width="100%" src="<?php echo PATH_IMAGE.'banner/banner-tour-da-lat.jpg' ?>" class="img-responsive"></a>
                </div>

            </div> 
            <?php //include 'footer.php'; ?>
        </div>
        </section>
   